<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,user-scalable=no,minimal-ui">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../img/asset-favico.ico">
    <title>预约</title>
    <link rel="stylesheet" href="../css/page-health-order.css"/>
    <link rel="stylesheet" href="../plugins/elementui/index.css">


</head>
<body data-spy="scroll" data-target="#myNavbar" data-offset="150">
<div class="app" id="app">
    <!-- 页面头部 -->
    <div class="top-header">
        <span class="f-left"><i class="icon-back" onclick="history.go(-1)"></i></span>
        <span class="center">传智健康</span>
        <span class="f-right"><i class="icon-more"></i></span>
    </div>
    <!-- 页面内容 -->
    <div class="contentBox">
        <div class="infinite-list-wrapper list-column1" style="overflow:scroll;height: 600px">
            <ul class="list"
                v-infinite-scroll="load"
                infinite-scroll-disabled="disabled">
                <li class="list-item" v-for="setmeal in setmealList">
                    <a class="link-page" :href="'setmeal_detail.html?id='+setmeal.id">
                        <img class="img-object f-left" :src="'http://qel4stjal.bkt.clouddn.com/'+setmeal.img" alt="">
                        <div class="item-body">
                            <h4 class="ellipsis item-title">{{setmeal.name}}</h4>
                            <p class="ellipsis-more item-desc">{{setmeal.remark}}</p>
                            <p class="item-keywords">
                                <span>{{setmeal.sex == '0' ? '性别不限' : setmeal.sex == '1' ? '男':'女'}}</span>
                                <span>{{setmeal.age}}</span>
                            </p>
                        </div>
                    </a>
                </li>
            </ul>
            <p v-if="loading"  align="center" style="color: #00a0e9">加载中...</p>
            <p v-if="noMore"  align="center" style="color: #00a0e9">没有更多了</p>
        </div>
    </div>

</div>
<!-- 页面 css js -->
<script src="../plugins/vue/vue.js"></script>
<script src="../plugins/vue/axios-0.18.0.js"></script>
<script src="../plugins/elementui/index.js"></script>
<!--<script src="../plugins/elementui/other_version/index.js"></script>-->
<!--<script src="../js/page-health-order.js"></script>-->
<script>
    var vue = new Vue({
        el: '#app',
        data: {
            setmealList: [],
            pagination: {//分页查询相关属性
                currentPage: 1,
                pageSize: 2,
                total: 100,
                queryString: null,
            },
            loading: false, //设置加载条是否显示
            count: 2//定义一个变量,用于瀑布流数据展示的计算
        },

        computed: {
            noMore() {
                return this.count >= this.pagination.total;
            },
            disabled() {
                return this.loading || this.noMore;
            }
        },
        mounted() {
            //调用分页查询
            //发送ajax请求,分页查询套餐数据,给模型数据setmealList套餐列表赋值
            axios.post("/setmeal/findPage.do", this.pagination).then((resp) => {
                this.pagination.total = resp.data.total;
                this.setmealList = resp.data.rows;
                this.loading = false ;//隐藏加载中
            });
        },
        methods: {
            load() {
                this.loading = true; //显示加载中
                setTimeout(() => {
                    this.findByPage();
                }, 2000)
            },
            //分页查询
            findByPage(){
                this.count += 2;
                this.pagination.pageSize += 2;
                var params = {
                    currentPage: 1, //当前页
                    pageSize: this.pagination.pageSize, //每页大小
                };
                //发送ajax请求,分页查询套餐数据,给模型数据setmealList套餐列表赋值
                axios.post("/setmeal/findPage.do", params).then((resp) => {
                    this.pagination.total = resp.data.total;
                    this.setmealList = resp.data.rows;
                    this.loading = false ;//隐藏加载中
                });
            }
        }
    });
</script>
</body>